package com.mall.app.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.mall.app.utils.MyAccount;
import com.mall.app.utils.enumeration.LoginType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;

import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * <p>
 * 商家表
 * </p>
 *
 * @author LeeSin
 * @since 2020-07-10
 */
@ApiModel(value="TbUser对象", description="商家表")
public class TbUser extends Model<TbUser> implements MyAccount{

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "商户id")
    @TableId(value = "uid", type = IdType.AUTO)
    private Integer uid;

    @ApiModelProperty(value = "商户名")
    private String uname;
    @TableLogic
    private Integer deleted;

    private LocalDateTime createTime;

    private LocalDateTime modifyTime;

    private String password;


    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(LocalDateTime modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    protected Serializable pkVal() {
        return this.uid;
    }

    @Override
    public String toString() {
        return "TbUser{" +
        "uid=" + uid +
        ", uname=" + uname +
        ", deleted=" + deleted +
        ", createTime=" + createTime +
        ", modifyTime=" + modifyTime +
        ", password=" + password +
        "}";
    }

    //@Override
	public LoginType getLoginType() {
		return LoginType.USER;
	}

	//@Override
	public String getUsername() {
		return getUname();
	}
	
	//@Override
	public Integer getId(){
		return getUid();
	}
}
